/**
 * 
 */
package com.training.serialization;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author uswvt9e
 * 
 */
public class SerializationTest {

	public static void main(String[] args) throws IOException {

		Teacher teacher = new Teacher();
		teacher.setAge(23);
		teacher.setDepartment("English");
		teacher.setName("Teacher_Name");

	  File file  =	new File(
		"C:\\OWN_FOLDER\\work/teacher.ser");
	  
	  if(file.createNewFile()){
		  System.out.println("File Created ");
	  }
		
		FileOutputStream fileOutputStream = new FileOutputStream(file);
		
		ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
		
		objectOutputStream.writeObject(teacher);

	}
	
	
	@Override
	protected void finalize() throws Throwable {
		// TODO Auto-generated method stub
		super.finalize();
	}
	
	

}
